﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EstepLibrary;
using System.Data;

public partial class includes_haberler : System.Web.UI.UserControl
{
    EstepLibrary.Veriler Kayitseti = new EstepLibrary.Veriler();
    EstepLibrary.GENELAYAR RSAyarlar = new EstepLibrary.GENELAYAR();
    EstepLibrary.Tool RSTool = new EstepLibrary.Tool();

    protected void Page_Load(object sender, EventArgs e)
    {
        getHOMENEWS();

    }

    private void getHOMENEWS()
    {
        string sorgu = RSTool.GetAnaHaberIDIcerik(RSAyarlar.ANAHABERID2, "null");
        DataTable dt = Kayitseti.GetDataTable(sorgu);
        sayfalama.PageSize = 3;
        sayfalama.DataSource = dt.DefaultView;
        sayfalama.BindToControl = rptHomeNews;
        rptHomeNews.DataSource = sayfalama.DataSourcePaged;
        rptHomeNews.DataBind();

    }
    protected void rptHomeNews_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        string RESIM = DataBinder.Eval(e.Item.DataItem, "RESIM").ToString();
        if (RESIM == "" || RESIM == null)
        {
            e.Item.FindControl("imgHaber").Visible = false;
            e.Item.FindControl("divHaberResim").Visible = false;
        }
        else
        {
            ((Image)e.Item.FindControl("imgHaber")).ImageUrl = RESIM;
        }
        

    }
}